package com.bookseek.xreader.views;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.Toolbar;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.bookseek.xreader.R;

public class RegisterActivity extends AppCompatActivity implements View.OnClickListener{

    EditText et_username,et_pwd;
    AppCompatButton register_btn;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        et_username = findViewById(R.id.et_username);
        et_pwd = findViewById(R.id.et_pwd);
        register_btn = findViewById(R.id.register_btn);
        register_btn.setOnClickListener(this);
        ((Toolbar)findViewById(R.id.tool_bar)).setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    private void registerBtnHandler(){
        String pwd = et_pwd.getText().toString().trim();
        String username = et_username.getText().toString().trim();
        Toast.makeText(this,"pwd="+pwd+";username="+username,Toast.LENGTH_SHORT).show();
    }
    @Override
    public void onClick(View view) {
        Log.i("Click","View.id=>"+(view.getId() == register_btn.getId()));
        if(view == register_btn){
            registerBtnHandler();
        }
    }
}